﻿using GN.Pay.TradeChannel.DefaultImpl;
using GN.Pay.Utils;
using GN.Pay.Utils.Security;
using System;
using System.Text;
using System.Web;

namespace GN.Pay.TradeChannel.AliPay.Request
{
    /// <summary>
    /// 即时支付请求
    /// </summary>
    [Serializable]
    class TransferPayRequest : AWebPayRequest
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="order"></param>
        /// <param name="config"></param>
        public TransferPayRequest(ITradeChannel channel,
            IOrderPayApply order,
            AliPayConfigure config) : base(channel, order, config)
        {
            Extra_common_param = order.ExtraParam;
            Exter_invoke_ip = order.ClientIP;
        }

        /// <summary>
        /// 获取服务 不可空
        /// </summary>
        public override string Service
        {
            get
            {
                return "create_direct_pay_by_user";
            }
        }

        /// <summary>
        /// 客户端Ip 用户在创建交易时，该用户当前所使用机器的IP。
        /// 如果商户申请后台开通防钓鱼IP地址检查选项，此字段必填，校验用。
        /// </summary>
        public string Exter_invoke_ip { get; set; }

        /// <summary>
        /// 公用回传参数 max (100)
        /// </summary>
        public string Extra_common_param { get; set; }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="channel"></param>
        /// <param name="config"></param>
        /// <returns></returns>
        public override ITradePayApplyResult Build(ITradeChannel channel, AliPayConfigure config)
        {
           // var dic = this.BuildSignDictionary(channel, config, "Sign", "Sign_Type");
          //  var requestStr = this.BuildHttpRequest(dic, config.ConfigureInfo.GateWayUrl, config.Encoding.WebName, "get");          
          //  return new TradePayApplyResult("", config.ConfigureInfo.GateWayUrl, requestStr, TradePayApplyResultCallType.Web_Script);           

           return base.Build(channel, config);
        }
    }
}
